package com.zyd.shiro.persistence.mapper;


import com.zyd.shiro.framework.object.BaseConditionVO;
import com.zyd.shiro.persistence.beans.PakRepairLine;
import com.zyd.shiro.persistence.beans.PakRestoreLine;
import com.zyd.shiro.plugin.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface PakRestoreLineMapper extends BaseMapper<PakRestoreLine> {

/**
     * 分页查询
     *
     * @param vo
     * @return
     */
    @Select("<script>"+
            "SELECT s.* FROM PAK_RESTORE_LINE s WHERE  1 = 1 " +
            " GROUP BY s.id ORDER BY s.create_time DESC " +
            "</script>")
    List<PakRestoreLine> findPageBreakByCondition(BaseConditionVO vo);

    @Select("<script>"+
            "SELECT s.* FROM PAK_RESTORE_LINE s WHERE " +
            "<choose>"+
            "<when  test='restoreId != 0 ' >" +
            " s.restore = #{restoreId , jdbcType=BIGINT}" +
            "</when >"+
            "<otherwise>"+
            " 1=2 "+
            "</otherwise>"+
            "</choose>"+
            " GROUP BY s.id ORDER BY s.create_time DESC " +
            "</script>")
    List<PakRestoreLine> findByRestore(@Param(value = "restoreId") Long restoreId);
}